﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using NuGet.Enterprise.Server.Configuration;

namespace NuGet.Enterprise.Server.Models.Feeds
{
    public class Feed
        : IFeed
    {
        private string _displayName;

        public string Name
        {
            get;
            set;
        }

        public string DisplayName
        {
            get { return (string.IsNullOrEmpty(_displayName) ? Name : _displayName); }
            set { _displayName = value; }
        }

        public string Url
        {
            get { return "/feed/{0}".FormatInvariant((IsDefault ? "_default" : Name)); }
        }

        public bool IsDefault
        {
            get { return (Name == BuildStoreSection.Current.Connections.DefaultConnectionName); }
        }
    }
}